<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>编辑员工</title>
		<script src="__INDEX__/store/js/mui.min.js"></script>
		<link href="__INDEX__/store/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__INDEX__/store/css/style.css" /> 
		<link rel="stylesheet" href="__INDEX__/store/css/sjhout.css" />
		<link rel="stylesheet" href="__INDEX__/store/css/wallet.css" />
		<link rel="stylesheet" href="__INDEX__/store/css/css.css" />
		<link rel="stylesheet" href="__INDEX__/store/css/newsj.css" /> 

		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script> 
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
			<h1 class="mui-title">编辑员工</h1> 
		</header>
		<div class="mui-content">
			<ul class="tjsyy_list">
				<li class="clearfix">
					<span class="left">员工号</span> 
					<span class="right"><input type="text" placeholder="请填写员工号" name='no' id='no' value="{$clerk_info['no']}" name='no' id='no'></span>
				</li>
				<li class="clearfix">
					<span class="left">账号</span>
					<span class="right"><input type="text" value="{$clerk_info['mobile']}" placeholder="填写登录账号" name='mobile' id='mobile'></span>
				</li>
				<!--<li class="clearfix">
					<span class="left">门店：</span>
					<span class="right">
					<select name='chain_id' id='chain_id' value="{$clerk_info['chain_id']}"  dir="rtl">
					{volist name="$agent_store" id="ad" empty=""}
						{if $clerk_info['chain_id'] == $ad.id}
							<option value="{$ad.id}">{$ad.store_name}</option>
						{/if}
					{/volist}
					{volist name="$agent_store" id="ad" empty=""}
						{if $clerk_info['chain_id'] != $ad.id}
							<option value="{$ad.id}">{$ad.store_name}</option>
						{/if}
					{/volist}
				</select>
					</span>
				</li>-->
			</ul>
			<ul class="tjsyy_list">
				<li class="clearfix">
					<span class="left">姓名</span>
					<span class="right"><input value="{$clerk_info['name']}" type="text" placeholder="填写真实姓名" name='name' id='name'></span>
				</li>
				<li class="clearfix">
					<span class="left">职位</span>
					<span class="right"> 
					<select name='z_id' id='z_id' value="{$clerk_info['ctype']}"  dir="rtl">
					{if $clerk_info['ctype'] == 1}
						<option value="1">员工</option>
						<option value="2">店长</option>
					{else}
						<option value="2" class="d">店长</option>
						<option value="1">员工</option>
					{/if}
				</select>
					</span> 
				</li> 
			</ul>
			<button type="button" class="tjsyy_btn">确定</button>
		</div>
	</body>

</html>
<script type="text/javascript" src="__INDEX__/store/js/jquery.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/castapp.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/layer/layer.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/picker.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/city.data-3.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/app.js"></script>
<script>
	$('.tjsyy_btn').click(function() {
		//员工号
		var no = $("#no").val();
		//所属门店
		//var chain_id = $("#chain_id").val();
		//职位
		var z_id = $("#z_id").val();
		//姓名
		var name = $("#name").val();
		//手机号
		var mobile = $("#mobile").val();
		var myreg = /^1[3578]\d{9}$/;
		if(name == "" || mobile == "" || no == "") {
			$("#create_emp").attr('disabled', false);
			layer.msg('请把信息填写完整');
			return false;
		}
		if(!myreg.test(mobile)) {
			$("#create_emp").attr('disabled', false);
			layer.msg('请输入有效的手机号码！');
			return false;
		}

		$.ajax({
			type: 'post',
			url: "{:url('agent/edite_emp')}",
			data: {
				no: no,
				//chain_id: chain_id,
				z_id: z_id,
				name: name,
				mobile: mobile,
				emp_id: "{$clerk_info['id']}"
			},
			success: function(data) {
				if(data.code == 200) {
					layer.msg(data.msg, {
						time: 2000
					}, function() {
						location.href = "{:url('agent/employeemage')}";
					});
				} else {
					layer.msg(data.msg);
				}
			}
		});
	}); 
</script>